<template>
  <view class="about-us-page">
    <Navbar title="关于我们" />

    <!-- 应用信息区域 -->
    <view class="app-info">
      <view class="logo-placeholder">
        <!-- 占位符logo -->
      </view>
      <text class="app-name">名称LOGO</text>
      <text class="app-version">Version 1.0.0 (版本号)</text>
    </view>

    <!-- 功能列表 -->
    <view class="function-list">
      <view class="function-item" @click="checkUpdate">
        <text class="function-text">检查更新</text>
        <image
          class="info-arrow"
          src="/static/img/minePages/mine-arrow.png"
          mode="widthFix"
        />
      </view>
      <view class="divider"></view>
      <view class="function-item" @click="showUserAgreement">
        <text class="function-text">用户协议</text>
        <image
          class="info-arrow"
          src="/static/img/minePages/mine-arrow.png"
          mode="widthFix"
        />
      </view>
      <view class="divider"></view>
      <view class="function-item" @click="showPrivacyPolicy">
        <text class="function-text">隐私政策</text>
        <image
          class="info-arrow"
          src="/static/img/minePages/mine-arrow.png"
          mode="widthFix"
        />
      </view>
    </view>

    <!-- 底部备案号 -->
    <view class="footer">
      <text class="filing-number">备案号: XXXXXXXXXXXXXXX</text>
    </view>
  </view>
</template>

<script setup>
import { createRequest } from '@/utils/request';
import Navbar from '@/components/Navbar.vue';
import { mygo } from '@/utils/useNavigator';

// 检查更新
async function checkUpdate() {
  mygo('/pages/minePages/update');
  // try {
  //   uni.showLoading({ title: '检查中...', mask: true });

  //   // 获取系统信息
  //   const systemInfo = uni.getSystemInfoSync();
  //   const currentVersion = systemInfo.version || '1.0.0';

  //   // 调用API检查版本更新
  //   const result = await createRequest('/app/check-version', {
  //     method: 'GET',
  //     data: {
  //       platform: systemInfo.platform,
  //       currentVersion: currentVersion,
  //       appId: systemInfo.appId
  //     }
  //   });

  //   uni.hideLoading();

  //   if (result.data.hasUpdate) {
  //     // 有更新，跳转到更新页面
  //     const updateInfo = encodeURIComponent(JSON.stringify(result.data));
  //     uni.navigateTo({
  //       url: `/pages/minePages/update?updateInfo=${updateInfo}`
  //     });
  //   } else {
  //     // 无更新
  //     uni.showToast({ title: '当前已是最新版本', icon: 'none' });
  //   }

  // } catch (error) {
  //   uni.hideLoading();
  //   console.error('检查更新失败:', error);
  //   uni.showToast({ title: '检查更新失败', icon: 'none' });
  // }
}

// 显示用户协议
function showUserAgreement() {
  uni.navigateTo({
    url: '/pages/minePages/userAgreement',
  });
}

// 显示隐私政策
function showPrivacyPolicy() {
  uni.navigateTo({
    url: '/pages/minePages/privacyPolicy',
  });
}
</script>

<style scoped lang="scss">
.about-us-page {
  @include page-with-header;
  background: #172869;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80rpx 40rpx 60rpx;
}

.logo-placeholder {
  width: 120rpx;
  height: 120rpx;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20rpx;
  margin-bottom: 30rpx;
}

.app-name {
  color: #fff;
  font-size: 36rpx;
  font-weight: 500;
  margin-bottom: 16rpx;
}

.app-version {
  color: rgba(255, 255, 255, 0.6);
  margin-top: 10rpx;
  font-size: 22rpx;
}

.function-list {
  margin: 0 32rpx;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0 20rpx;
  box-sizing: border-box;
  border-radius: 20rpx;
}

.function-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 40rpx 0;
  color: #fff;
  font-size: 32rpx;
}

.function-text {
  color: #fff;
}
.info-arrow {
  width: 14rpx;
}
.divider {
  height: 2rpx;
  background: rgba(255, 255, 255, 0.1);
}

.footer {
  position: fixed;
  bottom: 60rpx;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
}

.filing-number {
  color: rgba(255, 255, 255, 0.5);
  font-size: 24rpx;
}
</style>
